package copyengine.ui.tooltips.text
{
	import copyengine.ui.font.FontEmbedManger;
	import copyengine.utils.UIUtils;

	import flash.display.MovieClip;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;

	public final class CETextSizeAdjustHelper
	{
		public function CETextSizeAdjustHelper()
		{
		}

		public static function adjustTooltipsSize(_tipsMc:MovieClip, _text:String):void
		{
			var toolTipsFT:TextField = _tipsMc["tf"];
			var bgMc:MovieClip = _tipsMc["bg"];
			FontEmbedManger.instance.embedTextField(toolTipsFT);
			toolTipsFT.text = _text;

			//auteSzie会设置TF的高度等于Text的高度但是不会设置TF的Width
			toolTipsFT.autoSize = TextFieldAutoSize.CENTER;
			toolTipsFT.width = toolTipsFT.textWidth + 13;

			bgMc.width = toolTipsFT.width + 10;
			bgMc.height = toolTipsFT.height + 10;

			UIUtils.adjustPos(toolTipsFT, bgMc, UIUtils.ADJUST_POS_CENTER_FILL);
		}
	}
}
